package gui.other;

import gui.panel.AboutPanel;
import j_util.Utiles;

import javax.swing.*;
import java.awt.*;
/*

    This file is part of Logica-Logike.

    Logica-Logike is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation version 3 of the License.

    Logica-Logike is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Logica-Logike.  If not, see <http://www.gnu.org/licenses/>.

 */
/**
 * Dialogo con imagen de Logike usado al principio del programa, mientras se abre la aplicacion;
 *
 * @author Jose Martin Rozanec;
 */
public class IntroDialog extends Thread {
    private String imagePath;

    /**
     * Constructor;
     *
     * @param imagePath - filepath de la imagen a ser mostrada en el dialogo;
     */
    public IntroDialog(String imagePath) {
        this.imagePath = imagePath;
    }

    /**
     * Metodo run en el cual se inicializa el frame con la imagen a ser mostrada mientras se carga la aplicacion;
     */
    public void run() {
        imagePath = "/gui/images/Logica.png";
        JFrame frame = new JFrame();
        Dimension frameDimension = new Dimension(650, 680);
        frame.setContentPane(new AboutPanel());
        frame.setTitle("Logica 2.0");
        frame.setIconImage(Utiles.createImageIcon("/gui/images/other/logicaIcon.png").getImage());
        frame.setPreferredSize(frameDimension);
        frame.setSize(frameDimension);
        frame.setMinimumSize(frameDimension);
        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        frame.setResizable(false);
        Utiles.centerFrame(frame);
        frame.setVisible(true);
        try {
            sleep(3500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        frame.dispose();
    }
}
